package com.mvc.controller;

import com.mvc.service.DemoService;
import com.mvcframework.annotations.Autowired;
import com.mvcframework.annotations.Controller;
import com.mvcframework.annotations.RequestMapping;
import com.mvcframework.annotations.Security;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Created with IntelliJ IDEA by ChouFy on 2020-03-04.
 *
 * @author zhoufy
 */
@Controller
@RequestMapping("/demo")
public class DemoController {


    @Autowired
    private DemoService demoService;


    @RequestMapping("/a")
    @Security({"user1" , "user3"})
    public void demo(HttpServletRequest request, HttpServletResponse response, String name)  {
        String result = demoService.getName(name);
        try {
            response.getWriter().println(result);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
